\hypertarget{group__calib}{
\section{\-Calibration routines}
\label{group__calib}\index{\-Calibration routines@{\-Calibration routines}}
}


\-Calibration routines. \-Only accelerometer calibration is implemented since basic gyro calibration (bias) is trivial and is available on the \-I\-M\-U.  


\subsection*{\-Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{group__calib_ga272f4012a72ac416888be28bff0236e6}{estimate\-\_\-accelerometer\-\_\-biases} (void)
\begin{DoxyCompactList}\small\item\em \-Function that estimates the accelerometer biases given a matrix of the mean of the measured acceleration at different orientations. \end{DoxyCompactList}\item 
void \hyperlink{group__calib_gabb3f28a44a35898c77d789734914c4c2}{calibrate\-\_\-accelerometers} (void)
\begin{DoxyCompactList}\small\item\em \-Function for calibrating the accelerometer biases. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{\-Detailed \-Description}
\-Calibration routines. \-Only accelerometer calibration is implemented since basic gyro calibration (bias) is trivial and is available on the \-I\-M\-U. 

\subsection{\-Function \-Documentation}
\hypertarget{group__calib_gabb3f28a44a35898c77d789734914c4c2}{
\index{\-Calibration routines@{\-Calibration routines}!calibrate\-\_\-accelerometers@{calibrate\-\_\-accelerometers}}
\index{calibrate\-\_\-accelerometers@{calibrate\-\_\-accelerometers}!Calibration routines@{\-Calibration routines}}
\subsubsection[{calibrate\-\_\-accelerometers}]{\setlength{\rightskip}{0pt plus 5cm}void calibrate\-\_\-accelerometers (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{group__calib_gabb3f28a44a35898c77d789734914c4c2}


\-Function for calibrating the accelerometer biases. 

\-This function is used to calibrate the biases of the accelerometers in the \-I\-M\-U and requires the users to place the \-I\-M\-U into at least three different orientations. \-The calibration method is based upon the calibration algorithm described in the paper \href{https://eeweb01.ee.kth.se/upload/publications/reports/2010/IR-EE-SB_2010_046.pdf}{\tt \-Calibration of the \-Accelerometer \-Triad of an \-Inertial \-Measurement \-Unit, \-Maximum \-Likelihood \-Estimation and \-Cramer-\/\-Rao \-Bound}, but does only calibrate the accelerometer bias.

\-Before the calibration is started the flags {\itshape new\-\_\-orientation\-\_\-flag\/} and {\itshape acc\-\_\-calibration\-\_\-successful\-\_\-flag\/} should be set to false. \-Then the function should called every time new \-I\-M\-U-\/data have been read from the \-I\-M\-U and as long as the new flags {\itshape new\-\_\-orientation\-\_\-flag\/} and {\itshape acc\-\_\-calibration\-\_\-successful\-\_\-flag\/} are false. \-When the flag {\itshape new\-\_\-orientation\-\_\-flag\/} becomes true a message should be sent to the user, which then should place the \-I\-M\-U in a new orientation and reset the flag. \-When the flag {\itshape acc\-\_\-calibration\-\_\-successful\-\_\-flag\/} becomes true the calibration is finished and the accelerometer calibration parameters have been written into the memory of the \-I\-M\-U.

\begin{DoxyNote}{\-Note}
\-The function can return one error and one warning message that are stored in the variable \#error\-\_\-vec. \-The error message may be sent if the was no stationary during one of the calibration phases and new accelerometer data most be recorded with the \-I\-M\-U in the same orientation. \-A warning message may be sent if the orientations the \-I\-M\-U was placed in may have caused a poor estimate of the accelerometer biases.
\end{DoxyNote}

\begin{DoxyParams}[1]{\-Parameters}
\mbox{\tt out}  & {\em error\-\_\-vec} & \-A variable that is set non zero value of an error/warning has occurred during the \\
\hline
\mbox{\tt in,out}  & {\em acc\-\_\-calibration\-\_\-successful\-\_\-flag} & \-A flag that should be false when calibration is started and that becomes true when the calibration is finished. \\
\hline
\mbox{\tt in,out}  & {\em new\-\_\-orientation\-\_\-flag} & \-A flag that should be false when calibration is started and that becomes true when \-I\-M\-U should be placed in a new orientation. \-When the \-I\-M\-U has been placed in a new orientation it should be set to false. execution of the function. \\
\hline
\mbox{\tt in}  & {\em accelerations\-\_\-in} & \-The from the \-I\-M\-U latest read acceleration data. \\
\hline
\end{DoxyParams}
\hypertarget{group__calib_ga272f4012a72ac416888be28bff0236e6}{
\index{\-Calibration routines@{\-Calibration routines}!estimate\-\_\-accelerometer\-\_\-biases@{estimate\-\_\-accelerometer\-\_\-biases}}
\index{estimate\-\_\-accelerometer\-\_\-biases@{estimate\-\_\-accelerometer\-\_\-biases}!Calibration routines@{\-Calibration routines}}
\subsubsection[{estimate\-\_\-accelerometer\-\_\-biases}]{\setlength{\rightskip}{0pt plus 5cm}void estimate\-\_\-accelerometer\-\_\-biases (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{group__calib_ga272f4012a72ac416888be28bff0236e6}


\-Function that estimates the accelerometer biases given a matrix of the mean of the measured acceleration at different orientations. 


\begin{DoxyParams}[1]{\-Parameters}
\mbox{\tt out}  & {\em max\-\_\-v} & \-Largest value of the input vector. \\
\hline
\mbox{\tt out}  & {\em index} & \-Index of the vector element holding the largest value. \\
\hline
\mbox{\tt in}  & {\em arg\-\_\-vec} & \-The input vector. \\
\hline
\end{DoxyParams}
